//
//  UIWindow+Extension.m
//  WeiBTest
//
//  Created by Zc_zhou on 15/9/15.
//  Copyright (c) 2015年 Apple. All rights reserved.
//

#import "UIWindow+Extension.h"
#import "MainViewController.h"
#import "NewFeatureViewController.h"
@implementation UIWindow (Extension)

-(void)switchRootViewControl
{
    NSString *key = @"CFBundleVersion";
    
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];
    
    NSString *lastVersion = [[NSUserDefaults standardUserDefaults] objectForKey:key];
    
    if ([currentVersion isEqualToString:lastVersion]) {
        self.rootViewController = [[MainViewController alloc] init];
        
    }
    else
    {
        self.rootViewController = [[NewFeatureViewController alloc] init];
        [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:key];
        [[NSUserDefaults standardUserDefaults] synchronize];
        
    }

}
- (void)switchRootViewControl2
{
    NSString *key = @"CFBundleVersion";
    NSString *lastVersion = [[NSUserDefaults standardUserDefaults] objectForKey:key];
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];
    if ([lastVersion isEqualToString:currentVersion]) {
        self.rootViewController = [[MainViewController alloc] init];
    }
    else{
        self.rootViewController = [[NewFeatureViewController alloc] init];
        [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:key];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
}
@end
